{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "nbsphinx": "hidden"
   },
   "source": [
    "# Introduction\n",
    "\n",
    "*This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Digital Signal Processing\n",
    "\n",
    "A digital signal is a discrete representation of the information conveyed by the signal. The information itself may be discrete by nature, as numbers or letters, or it may be be continuous as most physical quantities. In many cases a digital signal has been derived by [sampling](https://en.wikipedia.org/wiki/Sampling_(signal_processing%29) and [quantization](https://en.wikipedia.org/wiki/Quantization_(signal_processing%29) of an analog signal captured by a sensor from the real world.\n",
    "\n",
    "![Analog, discrete and digital signal](analog_discrete_digital.png)\n",
    "\n",
    "The process of sampling and quantization is technically realized by an [analog-to-digital converter](https://en.wikipedia.org/wiki/Analog-to-digital_converter) (ADC). An example for a digital signal is the sound pressure produced by a human speaker picked up by a microphone whose electrical signal is fed into an ADC after amplification.\n",
    "\n",
    "[Digital Signal Processing](https://en.wikipedia.org/wiki/Digital_signal_processing) (DSP) refers to the digital processing of signals. The field covers the mathematics, algorithms, techniques and hardware to analyze, manipulate and generate digital signals. This may involve linear as well as nonlinear processing which is performed on the signals itself or their representations in other domains. For instance processing in the frequency or spectral domain. The processing is realized either directly in hardware or more common these days by software on general purpose or specialized ([Digital Signal Processor](https://en.wikipedia.org/wiki/Digital_signal_processor)) microprocessors. By use of a [digital-to-analog converter](https://en.wikipedia.org/wiki/Digital-to-analog_converter) (DAC) digital signals may be converted back into the analog domain. For instance to feed a loudspeaker or control a display. A typical signal processing chain is depicted below.\n",
    "\n",
    "![Digital signal processing chain](DSP.png)\n",
    "\n",
    "The history of DSP is directly coupled to the spread of microprocessors and computers. While many foundations may be found in the field of numerical mathematics before, specialized theory for the processing of digital signals has emerged in the 1950s. In its early stage, DSP was only applied to a few critical applications due to limited availability and high cost of microprocessors. However, with widespread availability of highly integrated circuits at reasonable prices the usage of DSP techniques has exploded since the 1980s. Nowadays, they can be found in almost any non-commercial and commercial device. Application areas include but are not limited to the processing of audio/image/video signals, communications engineering, radar/sonar/seismics, instrumentation, control systems, simulations and medicine. \n",
    "\n",
    "A number of benefits make the usage of digital in contrast to analog signal processing very attractive:\n",
    "\n",
    "* **robustness against external influences**: Analog systems show typically some gradual dependency on environmental conditions. For instance the analog elements of a circuit change their values when the ambient temperature changes. Digital systems generate the same results as long as the logic circuits/microprocessors are used within their technical specifications.\n",
    "* **long-term stability**: The elements of analog systems change their values gradually when aging. Digital systems do not show gradual changes until they malfunction. \n",
    "* **flexibility of implementations**: DSP implemented by means of software offers a high degree of flexibility which is hard to realize by analog circuits. For instance branching and looping.\n",
    "* **extended possibilities**: Besides traditional signal processing techniques (e.g. filtering) the digital processing of signals may involve algorithms from numerical mathematics or machine learning, just to name a few.\n",
    "\n",
    "In summary, at less technical effort the reproducibility of DSP is higher compared to analog signal processing. DSP system are typically cheaper compared to their analog counterparts. This is due to the tremendous efforts that have been spend in the last decades in the development and production of digital circuits."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exercises and Computational Examples \n",
    "\n",
    "The theory discussed in this course is accompanied by computational examples and exercises. They aim at improving the understanding and show typical applications. Most of the basis DSP techniques can be implemented quite straightforward in software. Various programming languages and software environments are used for this purpose. Quite common is the use of MATLAB® and Simulink® from [MathWorks®](https://www.mathworks.com), [GNU Octave](https://www.gnu.org/software/octave) and [Python](https://www.python.org/).\n",
    "\n",
    "Here interactive Python ([IPython](https://ipython.org/)) scripts are used which are directly embedded in [Jupyter](http://jupyter.org/) notebooks. The scripts and their results can be viewed straightforward as static snapshots. However, interactive use is highly recommended. For instance by rerunning the examples after a change of parameters. The exercises point to cases of interest and include also sample solutions. Feel motivated to extend the examples and write your own algorithms. If you are not familiar with IPython and Jupyter please take a look at the various tutorials available, for instance this [video](https://www.youtube.com/watch?v=HW29067qVWk). The examples base on various Python toolboxes/modules for convenience and performance. The basic functionality for most signal processing applications is provided by [`numpy`](http://www.numpy.org/) and [`scipy.signal`](https://docs.scipy.org/doc/scipy/reference/signal.html). For visualization purposes [`matplotlib`](https://matplotlib.org/) is used."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Contents\n",
    "\n",
    "An understanding of the underlying mechanisms and the limitations of basic DSP techniques is essential for the design of more complex algorithms. This course covers the fundamentals of DSP. A focus is laid on the discussion of generic building blocks in contrast to more specific complex algorithms. These blocks are addressed by a detailed mathematical treatise as well as practical examples and exercises. The discussion of the mathematical background is important to understand the principles of operation and derive properties in a more general manner. An outlook to practical applications is given whenever possible.\n",
    "\n",
    "The materials start off with a discussion of the limitations of **spectral analysis of deterministic signals**. These are essentially the limitations of the discrete Fourier transform and play therefore a prominent role in many fields of DSP. Practical signals are often of stochastic nature. The foundations of **random signals and their processing by linear time-invariant systems** is the next topic. It is not sensible to describe random signals by their amplitude values, instead statistical measures are introduced which characterize average properties. The **quantization** of sampled signals is required to derive a digital signal suitable for DSP. In general, quantization is  a non-linear process from which the amplitude continuous signal cannot be recovered exactly. In order to quantify the resulting deviations, a statistical analysis of the quantization error is presented for various signal classes. The filtering of signals is a basic task in DSP. The **realization of non-recursive and recursive filters** is therefore discussed in detail. Amongst others this covers practically relevant aspects like computationally efficient algorithms and the effects of quantization. For the **design of digital filters** various techniques are introduced in the last section."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Prerequisites\n",
    "\n",
    "The materials assume that the reader is already well familiarized with the theory of signals and linear time-invariant systems. In particular\n",
    "\n",
    "* continuous signals and systems,\n",
    "* Fourier and Laplace transform,\n",
    "* sampling of signals,\n",
    "* discrete signals and systems,\n",
    "* discrete-time Fourier transform (DTFT), discrete Fourier transform (DFT) and $z$-transform.\n",
    "\n",
    "These topics are covered by various textbooks."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "nbsphinx": "hidden"
   },
   "source": [
    "**Copyright**\n",
    "\n",
    "This notebook is provided as [Open Educational Resource](https://en.wikipedia.org/wiki/Open_educational_resources). Feel free to use the notebook for your own purposes. The text is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/), the code of the IPython examples under the [MIT license](https://opensource.org/licenses/MIT). Please attribute the work as follows: *Sascha Spors, Digital Signal Processing - Lecture notes featuring computational examples, 2016-2018*."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
